Revert "fix: marker series issue rebuild"#481
Conversation
This reverts commit 98ea7b6.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReverts the previous fix that forced marker-related widgets to remount when markerSeries changed, restoring the earlier, simpler widget structure for the marker area and main chart layout. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
|
Claude finished @behnam-deriv's task —— View job Code Review CompleteTasks
SummaryThis PR reverts the fix from #476 which added Critical Issues (High Priority)1. Potential Regression: MarkerArea State Persistence BugLocation: Issue: The original PR #476 added explicit keying to force widget remounting when
By removing both:
The widget tree may not properly rebuild when switching between different marker series instances, particularly during trade-type changes. Root Cause Analysis: Looking at
When
Evidence from code: // marker_area.dart:59-69
void _onTap(TapUpDetails details) {
final MarkerSeries series = widget.markerSeries; // <-- References current widget's series
if (series.activeMarker != null) {
if (series.activeMarker!.tapArea.contains(details.localPosition)) {
series.activeMarker!.onTap?.call();
} else {
series.activeMarker!.onTapOutside?.call();
}
return;
}
// ...
}While the Impact:
Recommendation:
Medium Priority Issues2. Missing Test CoverageIssue: There are no automated tests for marker rebuild behavior. This makes it:
Recommendation:
3. Unclear Justification for RevertIssue: The PR description only states "Reverts #476" without explaining:
Recommendation:
Low Priority Issues4. Code Comments RemovedLocation: The original fix included helpful documentation: // Force remount when markerSeries changes.
// LayoutBuilder only re-invokes its builder on constraint changes;
// without a key that tracks markerSeries identity, the old
// MarkerArea subtree persists after trade-type switches.Impact: Future developers lose context about this subtle Flutter framework behavior. Recommendation: If the revert is necessary, consider adding a comment explaining why keying is NOT needed in this case. Alternative Solutions to ConsiderInstead of reverting, consider these approaches:
@override
void didUpdateWidget(MarkerArea oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.markerSeries != widget.markerSeries) {
gestureManager
..removeCallback(_onTap)
..registerCallback(_onTap);
}
}
Testing RecommendationsBefore merging, please verify:
ConclusionRECOMMENDATION: Do not merge without further investigation. While code simplification is valuable, this revert appears to reintroduce a real bug related to stateful widget lifecycle management. The original fix may have been crude (forcing remounting), but it addressed a legitimate issue with gesture callback staleness. I recommend:
|
|
Reverting this since it breaks the drawing tools functionality on web |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- This revert removes the ObjectKey-based remount behavior for markerSeries; if the original change was addressing stale MarkerArea state on trade-type/series switches, it might be worth confirming whether you can keep a more targeted key (e.g., only on MarkerArea/KeyedSubtree) instead of fully reverting to avoid reintroducing that UI inconsistency.
- Since LayoutBuilder is now unkeyed again, markerSeries identity changes will no longer trigger subtree reconstruction; if the revert is meant to fix a specific regression (e.g., performance or unwanted rebuilds), consider documenting that reasoning in the commit message to clarify why the original behavior is preferred.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- This revert removes the ObjectKey-based remount behavior for markerSeries; if the original change was addressing stale MarkerArea state on trade-type/series switches, it might be worth confirming whether you can keep a more targeted key (e.g., only on MarkerArea/KeyedSubtree) instead of fully reverting to avoid reintroducing that UI inconsistency.
- Since LayoutBuilder is now unkeyed again, markerSeries identity changes will no longer trigger subtree reconstruction; if the revert is meant to fix a specific regression (e.g., performance or unwanted rebuilds), consider documenting that reasoning in the commit message to clarify why the original behavior is preferred.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Reverts #476
Summary by Sourcery
Revert the previous change that forced marker series widgets to remount when marker data changed, restoring the original marker area build behavior.